home *** CD-ROM | disk | FTP | other *** search
/ Crosscountry USA Photo Safari / Crosscountry USA Photo Safari.iso / Data / cc_base / pak00_16bit_f.pk3 / game_setup.gl.p < prev    next >
Text File  |  2003-04-25  |  15KB  |  513 lines

  1. {
  2.   ActiveWhileHidden = true;
  3.   Hidden = true;
  4.   ScriptID = Script {
  5.     @loaded {
  6.       int count;
  7.       resid commodity_data_id;
  8.       resid csv_data_id;
  9.  
  10.       csv_data_id = ResByName("CSVData");
  11.       commodity_data_id = ResPropGetResID(csv_data_id, "commodity_id");
  12.       
  13.       count = CSVGetRowCount(commodity_data_id) - 7;
  14.       
  15.       if (count < 12) {
  16.         ResPropSetInt(GuiChildByName(SELF,"com12"),"Hidden",TRUE);
  17.       }
  18.       if (count < 10) {
  19.         ResPropSetInt(GuiChildByName(SELF,"com10"),"Hidden",TRUE);
  20.       }    
  21.       if (count < 8) {
  22.         ResPropSetInt(GuiChildByName(SELF,"com8"),"Hidden",TRUE);
  23.       }      
  24.       if (count < 6) {
  25.         ResPropSetInt(GuiChildByName(SELF,"com6"),"Hidden",TRUE);
  26.       }          
  27.       if (count < 4) {
  28.         ResPropSetInt(GuiChildByName(SELF,"com4"),"Hidden",TRUE);
  29.       }
  30.     }   
  31.   };
  32.   ChildID = {
  33.  
  34.     GuiAnimation("plate") {
  35.       AnimationID = "anim/guage_gui/guage_window.pcx";
  36.       X = 0;
  37.       Y = 0;
  38.       Width = 480;
  39.       Height = 390;
  40.     },          
  41.  
  42.     GuiAnimation("guages") {
  43.       AnimationID = "anim/guage_gui/window/guagy.anm";
  44.       X = 0;
  45.       Y = 0;
  46.       Width = 340;
  47.       Height = 360;
  48.     },   
  49.  
  50.     GuiAnimation("num_player_label") {
  51.       X = 190;
  52.       Y = 70;
  53.       Width = 0;
  54.       Height = 0;
  55.       FontID = "font/square_black_on_gray_9.tf";            
  56.       TextID = Mangle(98/*"Number of Players:"*/);
  57.     },
  58.     
  59.     GuiButtonGroup("1Player") {
  60.       X = 180;
  61.       Y = 110;
  62.       RadioGroupID = 1;
  63.       ScriptID = Script {
  64.         @show {
  65.           ResParseEvent(SELF,"@activate");
  66.           ResPropSetResID(SELF, "ActiveButtonID", GuiChildByName(SELF, "radio_button_selected"));
  67.           ResPropSetResID(GuiSiblingByName("2PLayer"), "ActiveButtonID", GuiSiblingByName("2PLayer/radio_button_unselected"));
  68.         }
  69.         @activate { 
  70.                     ResPropSetInt(ResByName("Game"), "game_num_players", 1 );
  71.                     ResPropSetInt(GuiSiblingByName("player2_name"),"Hidden",TRUE);
  72.         }
  73.       };        
  74.       ChildID = {
  75.  
  76.             GuiButton("radio_button_unselected") {
  77.               StyleID = "gui/bs/radiounsel.gbs";
  78.               VerticalAlign = ABOVE;
  79.               TextDownOffsetX = 0;    
  80.               TextDownOffsetY = 0;                      
  81.               VerticalPadding = 4;
  82.               TextID = Mangle(99/*"1"*/);
  83.           FontID = "font/square_black_on_gray_9.tf";                          
  84.               ScriptID = Script {
  85.                 @activate {
  86.                 }
  87.               };
  88.              },          
  89.  
  90.             GuiButton("radio_button_selected") {
  91.               StyleID = "gui/bs/radiosel.gbs";
  92.               VerticalAlign = ABOVE;        
  93.               TextDownOffsetX = 0;
  94.               TextDownOffsetY = 0;                                        
  95.               VerticalPadding = 4;
  96.               TextID = Mangle(100/*"1"*/);
  97.           FontID = "font/square_black_on_gray_9.tf";                          
  98.               ScriptID = Script {
  99.                 @activate { 
  100.                 }
  101.               };
  102.              }        
  103.       };
  104.     },
  105.  
  106.     GuiButtonGroup("2PLayer") {
  107.       X = 210;
  108.       Y = 110;
  109.       RadioGroupID = 1;
  110.       ScriptID = Script {
  111.         @activate { 
  112.                     ResPropSetInt(ResByName("Game"), "game_num_players", 2 );
  113.                     ResPropSetInt(GuiSiblingByName("player2_name"),"Hidden",FALSE);                    
  114.         }
  115.       };              
  116.       ChildID = {
  117.                 GuiButton("radio_button_unselected") {
  118.               StyleID = "gui/bs/radiounsel.gbs";
  119.               VerticalAlign = ABOVE;            
  120.               TextDownOffsetX = 0;
  121.               TextDownOffsetY = 0;          
  122.               VerticalPadding = 4;
  123.               TextID = Mangle(101/*"2"*/);
  124.           FontID = "font/square_black_on_gray_9.tf";    
  125.               ScriptID = Script {
  126.                 @activate { 
  127.                 }
  128.               };
  129.              },          
  130.  
  131.             GuiButton("radio_button_selected") {
  132.               StyleID = "gui/bs/radiosel.gbs";
  133.               VerticalAlign = ABOVE;
  134.               TextDownOffsetX = 0;
  135.               TextDownOffsetY = 0;
  136.               VerticalPadding = 4;
  137.               TextID = Mangle(102/*"2"*/);
  138.           FontID = "font/square_black_on_gray_9.tf";      
  139.               ScriptID = Script {
  140.                 @activate { 
  141.                 }
  142.               };
  143.              }        
  144.       };
  145.     },
  146.     
  147.         GuiTextInput("player1_name") {
  148.       AnimationID = "gui/square/window/window_text_entry.pcx";
  149.       X = 180;
  150.       Y = 140;
  151.       Width = 120;
  152.       Height = 22;
  153.       InsertCursorID = "gui/dash/tab/insert_cursor.pcx";
  154.       OverwriteCursorID = "gui/dash/tab/overwrite_cursor.pcx";      
  155.       TextX = -50;
  156.       FontID = "font/square_black_on_gray_9.tf";
  157.       InputFontID = "font/verdana_9_black.tf";
  158.       TextID = Mangle(103/*"Name:"*/);
  159.       InputText = 32 : "player 1";
  160.       ScriptID = Script {
  161.             @mousedown {
  162.               if (StrExact(ResPropGetStr(SELF,"InputText"),"player 1")) {
  163.                 ResPropSetStr(SELF,"InputText","");
  164.               }
  165.             }
  166.       };
  167.     },
  168.  
  169.  
  170.  
  171.         GuiTextInput("player2_name") {
  172.       AnimationID = "gui/square/window/window_text_entry.pcx";
  173.       X = 180;
  174.       Y = 180;
  175.       InsertCursorID = "gui/dash/tab/insert_cursor.pcx";
  176.       OverwriteCursorID = "gui/dash/tab/overwrite_cursor.pcx";
  177.       Width = 120;
  178.       Height = 22;
  179.       TextX = -50;
  180.       FontID = "font/square_black_on_gray_9.tf";
  181.       InputFontID = "font/verdana_9_black.tf";      
  182.       TextID = Mangle(104/*"Name:"*/);
  183.       InputText = 32 : "player 2";
  184.       ScriptID = Script {
  185.             @mousedown {
  186.               if (StrExact(ResPropGetStr(SELF,"InputText"),"player 2")) {
  187.                 ResPropSetStr(SELF,"InputText","");
  188.               }
  189.             }
  190.       };
  191.     },
  192.  
  193.     
  194.     GuiAnimation("commod_label") {
  195.       X = 200;
  196.       Y = 230;
  197.       Width = 0;
  198.       Height = 0;
  199.       FontID = "font/square_black_on_gray_9.tf";            
  200.       TextID = Mangle(105/*"Number of Commodities:"*/);
  201.     },    
  202.     
  203.  
  204.     GuiButtonGroup("com2") {
  205.       X = 180;
  206.       Y = 260;
  207.       RadioGroupID = 4;
  208.       ScriptID = Script {
  209.         @activate {
  210.                     ResPropSetInt(ResByName("Player1Scenario"), "scenario_commodity_number_of", 2 );
  211.                     ResPropSetInt(ResByName("Player2Scenario"), "scenario_commodity_number_of", 2 );
  212.         }
  213.         @loaded {
  214.                     ResPropSetInt(ResByName("Player1Scenario"), "scenario_commodity_number_of", 2 );
  215.                     ResPropSetInt(ResByName("Player2Scenario"), "scenario_commodity_number_of", 2 );
  216.         }
  217.       };              
  218.       ChildID = {
  219.                 GuiButton("radio_button_unselected") {
  220.               StyleID = "gui/bs/radiounsel.gbs";
  221.               VerticalAlign = ABOVE;            
  222.               TextDownOffsetX = 0;
  223.               TextDownOffsetY = 0;          
  224.               VerticalPadding = 4;
  225.               TextID = Mangle(106/*"2"*/);
  226.           FontID = "font/square_black_on_gray_9.tf";    
  227.               ScriptID = Script {
  228.                 @activate { 
  229.                 }
  230.               };
  231.              },          
  232.  
  233.             GuiButton("radio_button_selected") {
  234.               StyleID = "gui/bs/radiosel.gbs";
  235.               VerticalAlign = ABOVE;
  236.               TextDownOffsetX = 0;
  237.               TextDownOffsetY = 0;
  238.               VerticalPadding = 4;
  239.               TextID = Mangle(107/*"2"*/);
  240.           FontID = "font/square_black_on_gray_9.tf";      
  241.               ScriptID = Script {
  242.                 @activate { 
  243.                 }
  244.               };
  245.              }        
  246.       };
  247.     },
  248.     
  249.     GuiButtonGroup("com4") {
  250.       X = 210;
  251.       Y = 260;
  252.       RadioGroupID = 4;
  253.       ScriptID = Script {
  254.         @activate {
  255.                     ResPropSetInt(ResByName("Player1Scenario"), "scenario_commodity_number_of", 4 );
  256.                     ResPropSetInt(ResByName("Player2Scenario"), "scenario_commodity_number_of", 4 );
  257.         }
  258.       };              
  259.       ChildID = {
  260.                 GuiButton("radio_button_unselected") {
  261.               StyleID = "gui/bs/radiounsel.gbs";
  262.               VerticalAlign = ABOVE;            
  263.               TextDownOffsetX = 0;
  264.               TextDownOffsetY = 0;          
  265.               VerticalPadding = 4;
  266.               TextID = Mangle(108/*"4"*/);
  267.           FontID = "font/square_black_on_gray_9.tf";    
  268.               ScriptID = Script {
  269.                 @activate { 
  270.                 }
  271.               };
  272.              },          
  273.  
  274.             GuiButton("radio_button_selected") {
  275.               StyleID = "gui/bs/radiosel.gbs";
  276.               VerticalAlign = ABOVE;
  277.               TextDownOffsetX = 0;
  278.               TextDownOffsetY = 0;
  279.               VerticalPadding = 4;
  280.               TextID = Mangle(109/*"4"*/);
  281.           FontID = "font/square_black_on_gray_9.tf";      
  282.               ScriptID = Script {
  283.                 @activate { 
  284.                 }
  285.               };
  286.              }        
  287.       };
  288.     },
  289.     
  290.     GuiButtonGroup("com6") {
  291.       X = 240;
  292.       Y = 260;
  293.       RadioGroupID = 4;
  294.       ScriptID = Script {
  295.         @activate { 
  296.                     ResPropSetInt(ResByName("Player1Scenario"), "scenario_commodity_number_of", 6 );
  297.                     ResPropSetInt(ResByName("Player2Scenario"), "scenario_commodity_number_of", 6 );
  298.         }
  299.       };              
  300.       ChildID = {
  301.                 GuiButton("radio_button_unselected") {
  302.               StyleID = "gui/bs/radiounsel.gbs";
  303.               VerticalAlign = ABOVE;            
  304.               TextDownOffsetX = 0;
  305.               TextDownOffsetY = 0;          
  306.               VerticalPadding = 4;
  307.               TextID = Mangle(110/*"6"*/);
  308.           FontID = "font/square_black_on_gray_9.tf";    
  309.               ScriptID = Script {
  310.                 @activate { 
  311.                 }
  312.               };
  313.              },          
  314.  
  315.             GuiButton("radio_button_selected") {
  316.               StyleID = "gui/bs/radiosel.gbs";
  317.               VerticalAlign = ABOVE;
  318.               TextDownOffsetX = 0;
  319.               TextDownOffsetY = 0;
  320.               VerticalPadding = 4;
  321.               TextID = Mangle(111/*"6"*/);
  322.           FontID = "font/square_black_on_gray_9.tf";      
  323.               ScriptID = Script {
  324.                 @activate { 
  325.                 }
  326.               };
  327.              }        
  328.       };
  329.     },
  330.  
  331.     GuiButtonGroup("com8") {
  332.       X = 270;
  333.       Y = 260;
  334.       RadioGroupID = 4;
  335.       ScriptID = Script {
  336.         @activate { 
  337.                     ResPropSetInt(ResByName("Player1Scenario"), "scenario_commodity_number_of", 8 );
  338.                     ResPropSetInt(ResByName("Player2Scenario"), "scenario_commodity_number_of", 8 );
  339.         }
  340.       };              
  341.       ChildID = {
  342.                 GuiButton("radio_button_unselected") {
  343.               StyleID = "gui/bs/radiounsel.gbs";
  344.               VerticalAlign = ABOVE;            
  345.               TextDownOffsetX = 0;
  346.               TextDownOffsetY = 0;          
  347.               VerticalPadding = 4;
  348.               TextID = Mangle(112/*"8"*/);
  349.           FontID = "font/square_black_on_gray_9.tf";    
  350.               ScriptID = Script {
  351.                 @activate { 
  352.                 }
  353.               };
  354.              },          
  355.  
  356.             GuiButton("radio_button_selected") {
  357.               StyleID = "gui/bs/radiosel.gbs";
  358.               VerticalAlign = ABOVE;
  359.               TextDownOffsetX = 0;
  360.               TextDownOffsetY = 0;
  361.               VerticalPadding = 4;
  362.               TextID = Mangle(113/*"8"*/);
  363.           FontID = "font/square_black_on_gray_9.tf";      
  364.               ScriptID = Script {
  365.                 @activate { 
  366.                 }
  367.               };
  368.              }        
  369.       };
  370.     },
  371.     
  372.     GuiButtonGroup("com10") {
  373.       X = 300;
  374.       Y = 260;
  375.       RadioGroupID = 4;
  376.       ScriptID = Script {
  377.         @activate { 
  378.                     ResPropSetInt(ResByName("Player1Scenario"), "scenario_commodity_number_of", 10 );
  379.                     ResPropSetInt(ResByName("Player2Scenario"), "scenario_commodity_number_of", 10 );
  380.         }
  381.       };              
  382.       ChildID = {
  383.                 GuiButton("radio_button_unselected") {
  384.               StyleID = "gui/bs/radiounsel.gbs";
  385.               VerticalAlign = ABOVE;            
  386.               TextDownOffsetX = 0;
  387.               TextDownOffsetY = 0;          
  388.               VerticalPadding = 4;
  389.               TextID = Mangle(114/*"10"*/);
  390.           FontID = "font/square_black_on_gray_9.tf";    
  391.               ScriptID = Script {
  392.                 @activate { 
  393.                 }
  394.               };
  395.              },          
  396.  
  397.             GuiButton("radio_button_selected") {
  398.               StyleID = "gui/bs/radiosel.gbs";
  399.               VerticalAlign = ABOVE;
  400.               TextDownOffsetX = 0;
  401.               TextDownOffsetY = 0;
  402.               VerticalPadding = 4;
  403.               TextID = Mangle(115/*"10"*/);
  404.           FontID = "font/square_black_on_gray_9.tf";      
  405.               ScriptID = Script {
  406.                 @activate { 
  407.                 }
  408.               };
  409.              }        
  410.       };
  411.     },    
  412.     
  413.     GuiButtonGroup("com12") {
  414.       X = 330;
  415.       Y = 260;
  416.       RadioGroupID = 4;
  417.       ScriptID = Script {
  418.         @activate { 
  419.                     ResPropSetInt(ResByName("Player1Scenario"), "scenario_commodity_number_of", 12 );
  420.                     ResPropSetInt(ResByName("Player2Scenario"), "scenario_commodity_number_of", 12 );
  421.         }
  422.       };              
  423.       ChildID = {
  424.                 GuiButton("radio_button_unselected") {
  425.               StyleID = "gui/bs/radiounsel.gbs";
  426.               VerticalAlign = ABOVE;            
  427.               TextDownOffsetX = 0;
  428.               TextDownOffsetY = 0;          
  429.               VerticalPadding = 4;
  430.               TextID = Mangle(116/*"12"*/);
  431.           FontID = "font/square_black_on_gray_9.tf";    
  432.               ScriptID = Script {
  433.                 @activate { 
  434.                 }
  435.               };
  436.              },          
  437.  
  438.             GuiButton("radio_button_selected") {
  439.               StyleID = "gui/bs/radiosel.gbs";
  440.               VerticalAlign = ABOVE;
  441.               TextDownOffsetX = 0;
  442.               TextDownOffsetY = 0;
  443.               VerticalPadding = 4;
  444.               TextID = Mangle(117/*"12"*/);
  445.           FontID = "font/square_black_on_gray_9.tf";      
  446.               ScriptID = Script {
  447.                 @activate { 
  448.                 }
  449.               };
  450.              }        
  451.       };
  452.     },
  453.  
  454.     GuiButton("main_menu") {
  455.       X = 100;
  456.       Y = 300;
  457.       TextID = Mangle(118/*"Main Menu"*/);
  458.       StyleID = "gui/bs/square.gbs";
  459.       FontID = "font/square_black_on_gray_9.tf";
  460.       Width = 150;
  461.       AutoSize = HEIGHT;
  462.       ScriptID = Script {
  463.         @activate { 
  464.           resid mc;
  465.              mc = ResByName("splash_screen.gl/menu_controller");
  466.           ResPropSetResID(mc,"panel_to_display", ResByName("main_menu.gl"));
  467.         }
  468.       };
  469.     },
  470.     
  471.     GuiButton("start_game") {
  472.       X = 260;
  473.       Y = 300;
  474.       TextID = Mangle(119/*"Start Game"*/);
  475.       StyleID = "gui/bs/square.gbs";
  476.       FontID = "font/square_black_on_gray_9.tf";
  477.       Width = 150;
  478.       AutoSize = HEIGHT;
  479.       ScriptID = Script {
  480.         @activate {
  481.           resid game_id;       
  482.           
  483.           game_id = ResByName("Game");
  484.  
  485.           /* set the current player to player 1 */
  486.           ResPropSetResID(game_id, "game_cur_player", ResByName("Player1"));
  487.  
  488.           /* set the players names into the player objects */
  489.                     ResPropSetStr(ResByName("Player1"), "player_name", ResPropGetStr(GuiSiblingByName("player1_name"),"InputText") );
  490.                      ResPropSetStr(ResByName("Player2"), "player_name", ResPropGetStr(GuiSiblingByName("player2_name"),"InputText") );
  491.                      
  492.                      /* init a random scenario */
  493.                      ResParseEvent(ResByName("common/init_scenario.c4"),"@INIT_SCENARIO");
  494.                     
  495.           /* init a game */
  496.                      ResParseEvent(ResByName("common/init_game.c4"),"@INIT_GAME");                     
  497.  
  498.                     release("floor");
  499.                     mark("floor");
  500.                     
  501.                     /* load the loading screen */
  502.                     ResByName("loader.gl");
  503.                     
  504.                     /* load the dispatch screen */
  505.                     /* ResByName("laptop.gl");  done by loader now */
  506.         }
  507.       };
  508.     }
  509.  
  510.  
  511.   };
  512. }
  513.